export default {
	data() {
		return {
			zhifubao: '',
			isBind: false,
			height: 0,
		}
	},
	methods: {
		goback() {
			uni.navigateBack()
		},
		tijiao() {
			var self = this
			if (self.zhifubao == null || self.zhifubao == "") {
				uni.showToast({
					title: "请输入支付宝号",
					icon: 'none',
				});
				return
			}
			http.post("/hall/set_userinfo", {
				zhifubao: self.zhifubao
			}).then((res) => {
				if (res.code && res.code != 200) {
					uni.showToast({
						title: res.description,
						icon: 'none',
					});
					return
				}

				uni.$emit('changeuserinfo', {
					zhifubao: self.zhifubao
				});

				uni.showToast({
					title: "设置成功!",
					icon: 'none',
				});
			}).catch((err) => {
				uni.showToast({
					title: "设置失败!",
					icon: 'none',
				});
				console.error(err)
			})
		}
	},
	onLoad: function(option) {
		console.log(option)
		var self = this
		uni.getSystemInfo({
			//成功获取的回调函数，返回值为系统信息
			success: (sysinfo) => {
				self.height = sysinfo.statusBarHeight + 'px'
			},
			complete: () => {}
		});
		if (option.zhifubao) {
			return
		}
		self.isBind = true;
		self.zhifubao = option.zhifubao;
	},
}